#!/usr/local/BLBIN/bin/php
<?php

function cpsrvd_for()
{
	exec('/bin/sed -i -s "s/208.74.121.85/208.74.122.85/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.85/208.74.122.85/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.82/208.74.122.82/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.82/208.74.122.82/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.86/208.74.122.86/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.86/208.74.122.86/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.83/208.74.122.83/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.83/208.74.122.83/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.2/208.74.121.2/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.2/208.74.121.2/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.3/208.74.121.3/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.3/208.74.121.3/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth.cpanel.net/auth.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth.cpanel.net/auth.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth2.cpanel.net/auth2.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth2.cpanel.net/auth2.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth5.cpanel.net/auth5.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth5.cpanel.net/auth5.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth7.cpanel.net/auth7.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth7.cpanel.net/auth7.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth9.cpanel.net/auth9.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth9.cpanel.net/auth9.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth3.cpanel.net/auth3.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth3.cpanel.net/auth3.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth10.cpanel.net/auth10.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth10.cpanel.net/auth10.dpanel.net/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/138.201.166.2/138.201.167.2/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/138.201.166.2/138.201.167.2/g" "/usr/local/cpanel/cpsrvd.so" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.85/208.74.122.85/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.85/208.74.122.85/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.82/208.74.122.82/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.82/208.74.122.82/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.86/208.74.122.86/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.86/208.74.122.86/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.83/208.74.122.83/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.83/208.74.122.83/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.2/208.74.121.2/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.2/208.74.121.2/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.3/208.74.121.3/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.3/208.74.121.3/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth.cpanel.net/auth.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth.cpanel.net/auth.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth2.cpanel.net/auth2.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth2.cpanel.net/auth2.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth5.cpanel.net/auth5.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth5.cpanel.net/auth5.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth7.cpanel.net/auth7.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth7.cpanel.net/auth7.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth9.cpanel.net/auth9.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth9.cpanel.net/auth9.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth3.cpanel.net/auth3.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth3.cpanel.net/auth3.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth10.cpanel.net/auth10.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth10.cpanel.net/auth10.dpanel.net/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/138.201.166.2/138.201.167.2/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/138.201.166.2/138.201.167.2/g" "/usr/local/cpanel/.cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.85/208.74.122.85/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.85/208.74.122.85/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.82/208.74.122.82/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.82/208.74.122.82/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.86/208.74.122.86/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.86/208.74.122.86/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.83/208.74.122.83/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.121.83/208.74.122.83/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.2/208.74.121.2/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.2/208.74.121.2/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.3/208.74.121.3/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/208.74.123.3/208.74.121.3/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth.cpanel.net/auth.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth.cpanel.net/auth.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth2.cpanel.net/auth2.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth2.cpanel.net/auth2.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth5.cpanel.net/auth5.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth5.cpanel.net/auth5.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth7.cpanel.net/auth7.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth7.cpanel.net/auth7.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth9.cpanel.net/auth9.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth9.cpanel.net/auth9.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth3.cpanel.net/auth3.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth3.cpanel.net/auth3.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth10.cpanel.net/auth10.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/auth10.cpanel.net/auth10.dpanel.net/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/138.201.166.2/138.201.167.2/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('/bin/sed -i -s "s/138.201.166.2/138.201.167.2/g" "/usr/local/cpanel/cpsrvd" > /dev/null 2>&1');
	exec('cat /usr/local/cpanel/cpane1.lisc > /usr/local/cpanel/cplpcp.lisc');
	exec('/bin/sed -i -s "s/maxusers: 30/maxusers: 0/g" "/usr/local/cpanel/cplpcp.lisc" > /dev/null 2>&1');
}

function remove_trial()
{
	system('echo "" > /usr/local/cpanel/whostmgr/docroot/templates/menu/_trial.tmpl &> /dev/null');
	system('sed -i -s "s/_is_trial/_is_tria1/g" "/usr/local/cpanel/base/show_template.stor" &> /dev/null');
	system('sed -i -s "s/IS_TRIAL/IS_TRIA1/g" "/usr/local/cpanel/base/resetpass.cgi" &> /dev/null');
	system('sed -i -e "s/CPANEL.CPFLAGS.item(\'trial\')/False/g" "/usr/local/cpanel/base/frontend/paper_lantern/_assets/master_glass/master_content.html.tt" &> /dev/null');
	system('sed -i -e "s/CPANEL.CPFLAGS.item(\'trial\')/False/g" "/usr/local/cpanel/base/frontend/paper_lantern/_assets/master_retro/master_content.html.tt" &> /dev/null');
	system('sed -i -e "s/CPANEL.CPFLAGS.item(\'trial\')/False/g" "/usr/local/cpanel/base/frontend/paper_lantern/_assets/master_content.html.tt" &> /dev/null');
	system('sed -i -e "s/CPANEL.CPFLAGS.item(\'trial\')/False/g" "/usr/local/cpanel/base/frontend/jupiter/_assets/master_retro/master_content.html.tt" &> /dev/null');
	system('sed -i -e "s/CPANEL.CPFLAGS.item(\'trial\')/False/g" "/usr/local/cpanel/base/frontend/jupiter/_assets/master_content.html.tt" &> /dev/null');
	system('sed -i -e "s/license_type = license_type _ \' TRIAL\'/license_type = license_type _ \'\'/g" "/usr/local/cpanel/whostmgr/docroot/templates/master_templates/_defheader.tmpl" &> /dev/null');
	system('sed -i -e "s/license_type = license_type _ \' TRIAL\'/license_type = license_type _ \'\'/g" "/usr/local/cpanel/whostmgr/docroot/templates/menu/main.tmpl" &> /dev/null');
}

function maximum_users()
{
	exec('whmapi1 get_maximum_users > /usr/local/CL/.max_users');
	$filech = file_get_contents('/usr/local/CL/.max_users');
	$postt = strpos($filech, 'maximum_users: 30');

	if ($postt) {
		exec('/usr/bin/licensescc > /dev/null 2>&1');
	}

	exec('rm -rf /usr/local/CL/.max_users &> /dev/null');
}

function check_license_expire()
{
	global $key;
	system('mkdir -p /usr/local/CL > /dev/null 2>&1');
	$private = '-----BEGIN PRIVATE KEY-----' . "\r\n" . 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC5Hq/0a7g3fR9Y' . "\r\n" . '7IteOpM9FIgocmBa/V7TkURXdT+5y3OpVED/FGyQ+WoBWi5bym6CgTlp5bM6QvTe' . "\r\n" . 'QAoVNvDyRjxB4dENBhls/Gr9B1JBcuG6pm1Ruizhu8NsfL5hiCbyZGzSu7L7LKaz' . "\r\n" . '457RoJ01pH7p8IVKxJdW1vNsTiCLgTLgjePkO/hTQJMwO6MvXnpQ3ViI8kECThVS' . "\r\n" . 'lkhrz4UveenmJXBaop038MW2Y0VtVWFaDBdJ+HFN6tueKhIEGbgkB//TyGBuPAS4' . "\r\n" . 'XDe7MQVzg8OUz8NAFrWcJBmVUep8qiDJwVm2m5AvMiUHN4SVyk5wgVZ6XtGeiuOZ' . "\r\n" . 'MUfCQeM3AgMBAAECggEATiIKqAIzLZBtA65LIIlejeA1m8SysJTSSj+89aDyNawO' . "\r\n" . 'dECwcjkfnYz31fxHJszpGcILBoxBumx6R7gFyXB3//nvAuuZvYJ+hsZ/La7CZAdm' . "\r\n" . 'CM6nw1/uA5SpZge8nxPFRHdoiwVYBLWS4shGxzmgQPzd6EVxLN6O9cMh2OucxuQY' . "\r\n" . 'G8HgZ8akklpG8GRiYCesDdHVNycSbm+KrpkMgFVsVbZ2U3kKoti9D3XS24a5vSD0' . "\r\n" . 'kmbkftljpiMZOnHlGGLEIfWFO8ZeS27CvTK1mYgJEibdSTHAsqbH11lw7AUtkIdD' . "\r\n" . 'JGldC+7RElS0bs5X08Vmt/IOeC/MBUa5mWgbUGsLmQKBgQDlk3T0qVLwjduNNFBX' . "\r\n" . 'OxmOI/yQPK5r3xwd6PJx4wxjFzBqq4U3Ew7Jxim2U3BrphliyZ81LwxfTVoJIN1i' . "\r\n" . 'gphkBx3vt3FF9TwFIYh4iQK9U4LCi5aJ6LenjK/UrRz9L9+A3+nabrBCNyKgkdwH' . "\r\n" . 'UaLrPutV7XxNkhdKhI3/bI0ZfQKBgQDObVBZ86DnVSlo6a8Yfe0g6hrdqumJSe+8' . "\r\n" . 'vDlZor3QjtELQ/9o0rZWnyVt8M/MxsZBmBpD/yiTBR8YM56+bBTUF6RooZPcedK7' . "\r\n" . 'JkYobA4bKbaB2sN3LcjaO0+Bk/VZfhgQQwR0CvCZLEnCv5yQYGXRCXfPDYaMQc72' . "\r\n" . 'rJ2JsCatwwKBgCiM+0OcBQJojDdM3kQKNGFfCeWQUl7LcfP2iZyENlPqbKrq0QUB' . "\r\n" . 'YMNTNVr3MgxRsno4kt6aCN1slFK4c2JLHw/MEgWdqWxp/MgLPEfOK6W1cotajKSf' . "\r\n" . 'bpEx0H0Idu5h3mCtLGlg09FeW8dw/CRuzxAudPMgl6w7+dE3yL0tN18hAoGABYCu' . "\r\n" . 'eqde66u+fdh03W9F6fGzo6MRtKIu7NYLpVMMQkn8UpOOdGnhiG+XnNWlhGzsDgWS' . "\r\n" . '9asQltK1IH0Hx0W0TG8Q5+UevurUbj638g3nVlwHTHDbcwraZs7b8LVT/f25gH14' . "\r\n" . '2esMvNiMYs+eyc54CFl7Qx62Lnj2nma9kFUMwucCgYEAsE/NPUBp/lLuGqSR+quj' . "\r\n" . 'sgdTIbttscOF5K+CYThJjBIAI4sMHC1qxgDgf0BAhUiL2NciQ6aIniSCkIoF5bpM' . "\r\n" . 'V7YU+L/ugiOfGVhFsji4X8E00dkqWHUZ1EaDCccoMV/gKKAbnsofUF6w4U/mk3bH' . "\r\n" . 'p2uA5sF5fX+kO3sqKGwfgoI=' . "\r\n" . '-----END PRIVATE KEY-----';

	if (!file_exists('/usr/local/CL/.licensekeycp2')) {
		exec('wget -O /usr/local/CL/.licensekeycp2 https://wc.cloudlicense.shop/api/' . $key . '/getlicense > /dev/null 2>&1');
		$getdata = file_get_contents('/usr/local/CL/.licensekeycp2');
		$file = json_decode($getdata, true);
		$data = base64_decode($file['sig']);
		$decrypted = openssl_private_decrypt($data, $decrypted_1, $private);
		$json = json_decode($decrypted_1, true);
		$valid = $json['second'];
		$validdate = date('m/d/Y h:i:s a', time());
		$valid2 = strtotime($validdate);
	}
	else {
		$getdata = file_get_contents('/usr/local/CL/.licensekeycp2');
		$file = json_decode($getdata, true);
		$data = base64_decode($file['sig']);
		$decrypted = openssl_private_decrypt($data, $decrypted_1, $private);
		$json = json_decode($decrypted_1, true);
		$valid = $json['second'];
		$validdate = date('m/d/Y h:i:s a', time());
		$valid2 = strtotime($validdate);
	}

	if (0 <= $valid2 - $valid) {
		exec('wget -O /usr/local/CL/.licensekeycp2 https://wc.cloudlicense.shop/api/' . $key . '/getlicense > /dev/null 2>&1');
		$getdata = file_get_contents('/usr/local/CL/.licensekeycp2');
		$file = json_decode($getdata, true);
		$data = base64_decode($file['sig']);
		$decrypted = openssl_private_decrypt($data, $decrypted_1, $private);
		$json = json_decode($decrypted_1, true);
		$valid = $json['second'];
		$validdate = date('m/d/Y h:i:s a', time());
		$valid2 = strtotime($validdate);

		if (0 <= $valid2 - $valid) {
			exec('chmod +x /usr/local/cpanel/cpsrvd > /dev/null 2>&1');
			exec('chmod +x /usr/local/cpanel/cpkeyclt');
			exec('umount /usr/local/cpanel/cpsanitycheck.so > /dev/null 2>&1');
			exec('umount /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
			exec('chattr -i /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
			exec('chattr -i /usr/local/cpanel/cpsanitycheck.so > /dev/null 2>&1');
			exec('chattr -a /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
			exec('chattr -a /usr/local/cpanel/cpsanitycheck.so > /dev/null 2>&1');
			exec('rm -rf /usr/local/cpanel/.lgbt > /dev/null 2>&1');

			if (file_exists('cp /usr/local/cpanel/scripts/restartsrv_cpsrvd1')) {
				exec('yes 2>/dev/null | cp /usr/local/cpanel/scripts/restartsrv_cpsrvd1 /usr/local/cpanel/scripts/restartsrv_cpsrvd');
			}

			exec('chmod +x /usr/local/cpanel/scripts/restartsrv_cpsrvd');
			exec('chattr -a /usr/local/cpanel/cpkeyclt 2> /dev/null');
			exec('rm -rf /usr/local/cpanel/cpsanitycheck.*');
			exec('rm -rf /usr/local/cpanel/cpane*.lis*');
			return true;
		}
	}

	return false;
}

function kill_licensecp()
{
	$current_process = getmypid();
	$killprocess = exec_output(' ps aux | grep LicenseCP | grep -v grep | awk \'{print  $2 }\'');
	$killprocess = explode("\r\n", $killprocess);

	foreach ($killprocess as $proc) {
		if ($proc != $current_process) {
			system('kill -9  ' . $proc . '  &> /dev/null');
		}
	}
}

function is_running()
{
	$running = false;

	if (file_exists('/usr/bin/pid/running.pid')) {
		$running_date = exec_output('expr $(expr $(date +%s) - $(stat /usr/bin/pid/running.pid -c %Y)) / 60');
		$running_date = (int) $running_date;

		if (10 < $running_date) {
			system('mkdir  -p "/usr/bin/pid" &> /dev/null');
			system('touch "/usr/bin/pid/running.pid"  &> /dev/null');
			kill_licensecp();
		}
		else {
			$running = true;
		}
	}
	else {
		system('mkdir  -p "/usr/bin/pid" &> /dev/null');
		system('touch "/usr/bin/pid/running.pid"  &> /dev/null');
		$running = false;
	}

	return $running;
}

echo "\r\n";
error_reporting(0);
$key = 'cpanel';
exec('crontab -l | grep -v \'(/usr/local/cpanel/scripts/fix-cpanel-perl; /usr/local/cpanel/scripts/upcp --cron > /dev/null)\'  | crontab -');
exec('crontab -l | grep -v \'/usr/local/cpanel/scripts/upcp --cron\'  | crontab -');
exec('crontab -l | grep -v \'/usr/local/cpanel/scripts/fix-cpanel-perl\'  | crontab -');

if (!file_exists('/usr/local/GB')) {
	exec('mkdir /usr/local/CL > /dev/null 2>&1');
}

if (file_exists('/usr/local/cpanel/cpanel_CL')) {
	exec('mv /usr/local/cpanel/*_CL /usr/local/CL > /dev/null 2>&1');
}

if (file_exists('/usr/local/cpanel/whostmgr/bin/whostmgr_CL')) {
	exec('mv /usr/local/cpanel/whostmgr/bin/*_CL /usr/local/CL > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/cpanel';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/cpanel');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/cpanel /usr/local/CL/cpanel_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/.cpanel2') !== md5_file('/usr/local/CL/cpanel_CL')) {
	$file = '/usr/local/cpanel/.cpanel2';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/.cpanel2');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/.cpanel2 /usr/local/CL/cpanel_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/cpanel_CL /usr/local/cpanel/.cpanel2 > /dev/null 2>&1');
	}
}

if (file_exists('/usr/bin/update_cpanelv2')) {
	exec('/usr/bin/update_cpanelv2 --Uninstall > /dev/null 2>&1');
	exec('rm -rf /usr/bin/update_cpanelv* > /dev/null 2>&1');
	exec('rm -rf /etc/cron.d/CSP* > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/uapi';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/uapi');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/uapi /usr/local/CL/uapi_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/.uapi') !== md5_file('/usr/local/CL/uapi_CL')) {
	$file = '/usr/local/cpanel/.uapi';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/.uapi');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/.uapi /usr/local/CL/uapi_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/uapi_CL /usr/local/cpanel/.uapi > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/cpsrvd';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/cpsrvd');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	if (md5_file('/usr/local/cpanel/cpsrvd') !== md5_file('/usr/local/cpanel/.cpsrvd')) {
		exec('cp /usr/local/cpanel/cpsrvd /usr/local/cpanel/.cpsrvd > /dev/null 2>&1');
	}
}
else {
	exec('cp /usr/local/cpanel/.cpsrvd /usr/local/cpanel/cpsrvd > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr /usr/local/CL/whostmgr_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.whostmgr') !== md5_file('/usr/local/CL/whostmgr_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.whostmgr /usr/local/CL/whostmgr_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/whostmgr_CL /usr/local/cpanel/whostmgr/bin/.whostmgr > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr2';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr2');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr2 /usr/local/CL/whostmgr2_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.whostmgr2') !== md5_file('/usr/local/CL/whostmgr2_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr2';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr2');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.whostmgr2 /usr/local/CL/whostmgr2_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/whostmgr2_CL /usr/local/cpanel/whostmgr/bin/.whostmgr2 > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr3';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr3');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr3 /usr/local/CL/whostmgr3_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.whostmgr3') !== md5_file('/usr/local/CL/whostmgr3_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr3';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr3');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.whostmgr3 /usr/local/CL/whostmgr3_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/whostmgr3_CL /usr/local/cpanel/whostmgr/bin/.whostmgr3 > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr4';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr4');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr4 /usr/local/CL/whostmgr4_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.whostmgr4') !== md5_file('/usr/local/CL/whostmgr4_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr4';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr4');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.whostmgr4 /usr/local/CL/whostmgr4_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/whostmgr4_CL /usr/local/cpanel/whostmgr/bin/.whostmgr4 > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr5';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr5');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr5 /usr/local/CL/whostmgr5_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.whostmgr5') !== md5_file('/usr/local/CL/whostmgr5_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr5';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr5');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.whostmgr5 /usr/local/CL/whostmgr5_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/whostmgr5_CL /usr/local/cpanel/whostmgr/bin/.whostmgr5 > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr6';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr6');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr6 /usr/local/CL/whostmgr6_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.whostmgr6') !== md5_file('/usr/local/CL/whostmgr6_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr6';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr6');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.whostmgr6 /usr/local/CL/whostmgr6_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/whostmgr6_CL /usr/local/cpanel/whostmgr/bin/.whostmgr6 > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr7';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr7');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr7 /usr/local/CL/whostmgr7_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.whostmgr7') !== md5_file('/usr/local/CL/whostmgr7_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr7';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr7');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.whostmgr7 /usr/local/CL/whostmgr7_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/whostmgr7_CL /usr/local/cpanel/whostmgr/bin/.whostmgr7 > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr9';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr9');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr9 /usr/local/CL/whostmgr9_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.whostmgr9') !== md5_file('/usr/local/CL/whostmgr9_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr9';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr9');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.whostmgr9 /usr/local/CL/whostmgr9_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/whostmgr9_CL /usr/local/cpanel/whostmgr/bin/.whostmgr9 > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr11';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr11');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr11 /usr/local/CL/whostmgr11_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.whostmgr11') !== md5_file('/usr/local/CL/whostmgr11_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr11';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr11');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.whostmgr11 /usr/local/CL/whostmgr11_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/whostmgr11_CL /usr/local/cpanel/whostmgr/bin/.whostmgr11 > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr12';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr12');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr12 /usr/local/CL/whostmgr12_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.whostmgr12') !== md5_file('/usr/local/CL/whostmgr12_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr12';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr12');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.whostmgr12 /usr/local/CL/whostmgr12_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/whostmgr12_CL /usr/local/cpanel/whostmgr/bin/.whostmgr12 > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/whostmgr/bin/xml-api';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/xml-api');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/xml-api /usr/local/CL/xml-api_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.xml-api') !== md5_file('/usr/local/CL/xml-api_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.xml-api';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.xml-api');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.xml-api /usr/local/CL/xml-api_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/xml-api_CL /usr/local/cpanel/whostmgr/bin/.xml-api > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr10';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr10');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if ((1 < $filesize) && ($posttt1 !== false)) {
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr10 /usr/local/CL/whostmgr10_CL > /dev/null 2>&1');
}

if (md5_file('/usr/local/cpanel/whostmgr/bin/.whostmgr10') !== md5_file('/usr/local/CL/whostmgr10_CL')) {
	$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr10';
	$filesize = filesize($file);
	$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr10');
	$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
	if ((1 < $filesize) && ($posttt1 !== false)) {
		exec('cp /usr/local/cpanel/whostmgr/bin/.whostmgr10 /usr/local/CL/whostmgr10_CL > /dev/null 2>&1');
	}
	else {
		exec('cp /usr/local/CL/whostmgr10_CL /usr/local/cpanel/whostmgr/bin/.whostmgr10 > /dev/null 2>&1');
	}
}

$file = '/usr/local/cpanel/cpanel';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/cpanel');
$posttt = strpos($filech1, '/usr/local/cpanel/.cpanel2');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (($posttt !== false) && (1 < $filesize) && !$posttt1) {
	exec('wget -O /usr/local/cpanel/cpanel wc.cloudlicense.shop/api/files/' . $key . '/m2/cpb > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/cpanel > /dev/null 2>&1');
}

$file = exec('ps -ef | grep GBdaemon > /usr/local/CL/.daemon');
$file2 = file_get_contents('/usr/local/CL/.daemon');
$pos = strpos($file2, '/usr/bin/GBdaemon');

if ($pos !== false) {
	exec('service GBCP stop > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/cpanel';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/uapi');
$posttt = strpos($filech1, '/usr/local/cpanel/.uapi');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (($posttt !== false) && (1 < $filesize) && !$posttt1) {
	exec('wget -O /usr/local/cpanel/uapi wc.cloudlicense.shop/api/files/' . $key . '/m2/cpb2 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/uapi > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr');
$posttt = strpos($filech1, '/usr/local/cpanel/whostmgr/bin/.whostmgr');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (($posttt !== false) && (1 < $filesize) && !$posttt1) {
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr wc.cloudlicense.shop/api/files/' . $key . '/m2/whm > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr2 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm2 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr3 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm3 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr4 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm4 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr5 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm5 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr6 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm6 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr7 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm7 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr9 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm9 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr10 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm10 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr11 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm11 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr12 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm12 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr2 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr3 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr4 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr5 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr6 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr7 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr9 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr10 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr11 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr12 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/cpanel';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/cpanel');
$posttt = strpos($filech1, '(GNU) 4.8.5 20150623');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!(($posttt !== false) && (1 < $filesize) && !$posttt1)) {
	exec('rm -rf /usr/local/cpanel/.cpanel2 > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/cpanel /usr/local/cpanel/.cpanel2 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/cpanel wc.cloudlicense.shop/api/files/' . $key . '/m2/cpb > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/cpanel > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/.cpanel2 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/.ltrc wc.cloudlicense.shop/date/current > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/cpanel';
$filesize = filesize($file);

if ($filesize <= 300000) {
	exec('wget -O /usr/local/cpanel/cpanel wc.cloudlicense.shop/api/files/' . $key . '/m2/cpb > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/cpanel > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/.cpanel2 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/.cpanel2';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/.cpanel2');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/cpanel_CL /usr/local/cpanel/.cpanel2 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/uapi';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/uapi');
$posttt = strpos($filech1, '(GNU) 4.8.5 20150623');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!(($posttt !== false) && (1 < $filesize) && !$posttt1)) {
	exec('rm -rf /usr/local/cpanel/.uapi > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/uapi /usr/local/cpanel/.uapi > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/uapi wc.cloudlicense.shop/api/files/' . $key . '/m2/cpb2 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/uapi > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/.uapi > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/.ltrc wc.cloudlicense.shop/date/current > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/.uapi';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/.uapi');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/uapi_CL /usr/local/cpanel/.uapi > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/cpsrvd_recover';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/cpsrvd_recover');
$posttt = strpos($filech1, '(GNU) 4.8.5 20150623');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!(($posttt !== false) && (1 < $filesize) && !$posttt1)) {
	exec('wget -O /usr/local/cpanel/cpsrvd_recover wc.cloudlicense.shop/api/files/' . $key . '/m2/cpsrvd > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/cpsrvd > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/.cpsrvd > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/cpsrvd_recover > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/cpsrvd_recover';
$filesize = filesize($file);

if ($filesize != 338896) {
	exec('wget -O /usr/local/cpanel/cpsrvd_recover wc.cloudlicense.shop/api/files/' . $key . '/m2/cpsrvd > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/cpsrvd > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/.cpsrvd > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/cpsrvd_recover > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/whostmgr';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/whostmgr');
$posttt = strpos($filech1, '(GNU) 4.8.5 20150623');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!(($posttt !== false) && (1 < $filesize) && !$posttt1)) {
	exec('rm -rf /usr/local/cpanel/whostmgr/bin/.whostmg* > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr /usr/local/cpanel/whostmgr/bin/.whostmgr > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr2 /usr/local/cpanel/whostmgr/bin/.whostmgr2 > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr3 /usr/local/cpanel/whostmgr/bin/.whostmgr3 > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr4 /usr/local/cpanel/whostmgr/bin/.whostmgr4 > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr5 /usr/local/cpanel/whostmgr/bin/.whostmgr5 > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr6 /usr/local/cpanel/whostmgr/bin/.whostmgr6 > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr7 /usr/local/cpanel/whostmgr/bin/.whostmgr7 > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr9 /usr/local/cpanel/whostmgr/bin/.whostmgr9 > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr10 /usr/local/cpanel/whostmgr/bin/.whostmgr10 > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr11 /usr/local/cpanel/whostmgr/bin/.whostmgr11 > /dev/null 2>&1');
	exec('cp /usr/local/cpanel/whostmgr/bin/whostmgr12 /usr/local/cpanel/whostmgr/bin/.whostmgr12 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr wc.cloudlicense.shop/api/files/' . $key . '/m2/whm > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr2 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm2 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr3 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm3 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr4 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm4 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr5 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm5 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr6 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm6 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr7 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm7 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr9 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm9 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr10 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm10 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr11 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm11 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/whostmgr/bin/whostmgr12 wc.cloudlicense.shop/api/files/' . $key . '/m2/whm12 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr2 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr3 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr4 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr5 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr6 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr7 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr9 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr10 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr11 > /dev/null 2>&1');
	exec('chmod +x /usr/local/cpanel/whostmgr/bin/whostmgr12 > /dev/null 2>&1');
	exec('wget -O /usr/local/cpanel/.ltrc wc.cloudlicense.shop/date/current > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/whostmgr_CL /usr/local/cpanel/whostmgr/bin/.whostmgr > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr10';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr10');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/whostmgr10_CL /usr/local/cpanel/whostmgr/bin/.whostmgr10 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr2';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr2');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/whostmgr2_CL /usr/local/cpanel/whostmgr/bin/.whostmgr2 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr3';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr3');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/whostmgr3_CL /usr/local/cpanel/whostmgr/bin/.whostmgr3 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr4';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr4');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/whostmgr4_CL /usr/local/cpanel/whostmgr/bin/.whostmgr4 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr5';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr5');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/whostmgr5_CL /usr/local/cpanel/whostmgr/bin/.whostmgr5 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr6';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr6');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/whostmgr6_CL /usr/local/cpanel/whostmgr/bin/.whostmgr6 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr7';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr7');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/whostmgr7_CL /usr/local/cpanel/whostmgr/bin/.whostmgr7 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr9';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr9');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/whostmgr9_CL /usr/local/cpanel/whostmgr/bin/.whostmgr9 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr11';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr11');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/whostmgr11_CL /usr/local/cpanel/whostmgr/bin/.whostmgr11 > /dev/null 2>&1');
}

$file = '/usr/local/cpanel/whostmgr/bin/.whostmgr12';
$filesize = filesize($file);
$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.whostmgr12');
$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
if (!((1 < $filesize) && ($posttt1 !== false))) {
	exec('cp /usr/local/CL/whostmgr12_CL /usr/local/cpanel/whostmgr/bin/.whostmgr12 > /dev/null 2>&1');
}

exec('/scripts/updateuserdomains > /dev/null 2>&1');
exec('faketime > /usr/local/CL/.procheck 2>&1');
$filexml = file_get_contents('/usr/local/CL/.procheck');
$pose = strpos($filexml, 'Usage: faketime');

if ($pose !== false) {
	exec('cp /usr/bin/faketime /usr/bin/cpd > /dev/null 2>&1');
	exec('rm -rf /usr/local/CL/.procheck > /dev/null 2>&1');
}
else {
	exec('cd /home && wget http://li.nux.ro/download/nux/misc/el6/x86_64//libfaketime-0.9.6-2.el6.nux.x86_64.rpm > /dev/null 2>&1 && yum localinstall libfaketime-0.9.6-2.el6.nux.x86_64.rpm -y > /dev/null 2>&1');
	exec('cp /usr/bin/faketime /usr/bin/cpd > /dev/null 2>&1');
	exec('chmod +x /usr/bin/cpd > /dev/null 2>&1');
	exec('ln -s /usr/lib64/libfaketime.so.1 /usr/lib64/faketime > /dev/null 2>&1');
	exec('rm -rf /usr/local/CL/.procheck > /dev/null 2>&1');
	exec('rm -rf /home/libfaketime-0.9.6-2.el6.nux.x86_64.rpm > /dev/null 2>&1');
}

exec('rm -rf /root/cp.p* > /dev/null 2>&1');
exec('rm -rf /root/cp.result > /dev/null 2>&1');

if (in_array('--force', $argv)) {
	kill_licensecp();
	exec('rm -rf /root/GBCP.lock > /dev/null 2>&1');
}

$lock = '/root/GBCP.lock';

if (file_exists($lock)) {
	exec('sed \'s/^ *//g\' /root/.gbcp.pid1 > /root/.gbcp.pid 2>&1');
	$pid = file_get_contents('/root/.gbcp.pid');
	exec('ps -ef | grep ' . $pid . '');
	$filexml = file_get_contents('/root/.gbcp.result');
	$pose = strpos($filexml, 'LicenseCP');

	if ($pose !== false) {
		printf("\x1b" . '[32mCpanel Status [Running in Background]' . "\x1b" . '[0m ' . "\n");
		echo "\n";
		echo "\n";
		echo "\x1b" . '[32mRun : LicenseCP_v2 --force ' . "\x1b" . '[0m' . "\n";
	}
	else {
		exec('rm -rf /root/GBCP.lock > /dev/null 2>&1');
		echo "\n\n" . 'cPanel license LOCK file exists but not running... removing it...' . "\n";
	}
}
else {
	$lock1 = '/root/GBCP.lock';

	if (file_exists($lock1)) {
		exec('sed \'s/^ *//g\' /root/.gbcp.pid1 > /root/.gbcp.pid 2>&1');
		$pid = file_get_contents('/root/.gbcp.pid');
		exec('ps -ef | grep ' . $pid . '');
		$filexml = file_get_contents('/root/.gbcp.result');
		$pose = strpos($filexml, 'LicenseCP');

		if ($pose !== false) {
			printf("\x1b" . '[32mCpanel Status [Running in Background]' . "\x1b" . '[0m ' . "\n");
			echo "\n";
			echo "\n";
			echo "\x1b" . '[32mRun : LicenseCP_v2 --force ' . "\x1b" . '[0m' . "\n";
		}
		else {
			exec('rm -rf /root/GBCP.lock > /dev/null 2>&1');
			echo "\n\n" . 'cPanel license LOCK file exists but not running... removing it...' . "\n";
		}
	}
	else {
		exec('rm -rf /usr/local/CL/.cp.p* > /dev/null 2>&1');
		exec('rm -rf /usr/local/CL/.cp.result > /dev/null 2>&1');
		exec('touch /root/CP.lock');
		exec('echo $(ps -o ppid= -p "$$") "| grep -v grep > /usr/local/CL/.cp.result" > /usr/local/CL/.cp.pid1');
		exec('rm -rf /usr/local/CL/.ping > /dev/null 2>&1');
		$file11 = exec('timeout 3s ping auth.cpanel.net  &> /usr/local/CL/.ping');
		$file22 = file_get_contents('/usr/local/CL/.ping');
		$pos = strpos($file22, 'bytes from');

		if ($pos !== false) {
			exec('iptables -P INPUT ACCEPT > /dev/null 2>&1');
			exec('iptables -P FORWARD ACCEPT > /dev/null 2>&1');
			exec('iptables -P OUTPUT ACCEPT > /dev/null 2>&1');
			exec('iptables -t nat -F  > /dev/null 2>&1');
			exec('iptables -t mangle -F > /dev/null 2>&1');
			exec('iptables -F > /dev/null 2>&1');
			exec('iptables -X > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A INPUT -s 208.74.121.85 -j DROP > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A INPUT -s 208.74.121.86 -j DROP > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A INPUT -s 208.74.123.3 -j DROP > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A INPUT -s 208.74.121.83 -j DROP > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A INPUT -s 208.74.121.82 -j DROP > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A INPUT -s 208.74.123.2 -j DROP > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A OUTPUT -s 208.74.121.85 -j DROP > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A OUTPUT -s 208.74.121.86 -j DROP > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A OUTPUT -s 208.74.123.3 -j DROP > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A OUTPUT -s 208.74.121.83 -j DROP > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A OUTPUT -s 208.74.121.82 -j DROP > /dev/null 2>&1');
			exec('/usr/sbin/iptables -A OUTPUT -s 208.74.123.2 -j DROP > /dev/null 2>&1');
			exec('yum -y install ipset > /dev/null 2>&1');
			exec('ipset create lp nethash > /dev/null 2>&1');
			exec('ipset add lp 208.74.121.85 > /dev/null 2>&1');
			exec('ipset add lp 208.74.121.86 > /dev/null 2>&1');
			exec('ipset add lp 208.74.123.3 > /dev/null 2>&1');
			exec('ipset add lp 208.74.121.83 > /dev/null 2>&1');
			exec('ipset add lp 208.74.121.82 > /dev/null 2>&1');
			exec('ipset add lp 208.74.123.2 > /dev/null 2>&1');
			exec('sudo iptables -t nat -A OUTPUT -p tcp -m multiport --dports 80,443,2089,23,25 -m set --match-set lp dst -j DNAT --to-destination 195.201.128.18 > /dev/null 2>&1');
			exec('/sbin/iptables -S > /dev/null 2>&1');
			exec('/sbin/iptables-save > /dev/null 2>&1');
			exec('/bin/sh /sbin/service iptables save > /dev/null 2>&1');
			exec('/sbin/iptables -N cP-Firewall-1-INPUT > /dev/null 2>&1');
			exec('/sbin/iptables -I INPUT 1 -j cP-Firewall-1-INPUT > /dev/null 2>&1');
			exec('/sbin/iptables -I FORWARD 1 -j cP-Firewall-1-INPUT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2079 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2077 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2087 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 993 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2096 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8443 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 26 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2082 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2083 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2080 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2091 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 49152:65534 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 110 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 995 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2078 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2090 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 587 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 465 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 579 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2086 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2095 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 143 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -A cP-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 53 -j ACCEPT > /dev/null 2>&1');
			exec('/sbin/iptables -S > /dev/null 2>&1');
			exec('/sbin/iptables-save > /dev/null 2>&1');
			exec('/bin/sh /sbin/service iptables save > /dev/null 2>&1');
			exec('csf -s > /dev/null 2>&1');
			exec('csf -d 208.74.123.2 > /dev/null 2>&1');
			exec('csf -d 208.74.121.82 > /dev/null 2>&1');
			exec('csf -d 208.74.121.83 > /dev/null 2>&1');
			exec('csf -d 208.74.123.3 > /dev/null 2>&1');
			exec('csf -d 208.74.121.86 > /dev/null 2>&1');
			exec('csf -d 208.74.121.85 > /dev/null 2>&1');
			$filenamea = '/usr/bin/gblicensels';

			if (file_exists($filenamea)) {
				exec('sudo iptables -t nat -A OUTPUT -d 34.231.236.27 -j DNAT --to-destination 127.0.0.1 > /dev/null 2>&1');
				exec('sudo iptables -t nat -A OUTPUT -d 167.99.112.67 -j DNAT --to-destination 127.0.0.1 > /dev/null 2>&1');
				exec('sudo iptables -t nat -A OUTPUT -d 52.55.120.73 -j DNAT --to-destination 127.0.0.1 > /dev/null 2>&1');
				exec('echo 1 > /proc/sys/net/ipv4/ip_forward > /dev/null 2>&1');
			}
		}

		$file = '/usr/local/cpanel/cpkeyclt';
		$filesize = filesize($file);
		$filech1 = file_get_contents('/usr/local/cpanel/cpkeyclt');
		$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
		if ((1 < $filesize) && ($posttt1 !== false)) {
			exec('rm -rf /usr/local/cpanel/.cpkeyclt > /dev/null 2>&1');
			exec('cp /usr/local/cpanel/cpkeyclt /usr/local/cpanel/.cpkeyclt > /dev/null 2>&1');
		}

		$file22 = file_get_contents('/usr/local/cpanel/cpkeyclt');
		$pos = strpos($file22, 'php /usr/bin/LicenseCP_v2');

		if ($pos === false) {
			exec('comp0 -a /usr/local/cpanel/cpkeyclt > /dev/null 2>&1');
			exec('wget -O /usr/local/cpanel/cpkeyclt wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/cpkeycltGB > /dev/null 2>&1');
		}

		$file = '/usr/local/cpanel/cpanel';
		$file2 = file_get_contents('/usr/local/cpanel/cpanel');
		$filesize = filesize($file);

		if (1 < $filesize) {
			$postt = strpos($file2, 'cpanel.lisc');

			if ($postt === false) {
				$filenameli = file_get_contents('/usr/local/cpanel/cpanel1');

				if (file_exists($filenameli)) {
					exec('rm -rf /usr/local/cpanel/cpanel && cp /usr/local/cpanel/cpanel1 /usr/local/cpanel/cpanel > /dev/null 2>&1');
				}
			}
		}
		else {
			$filenameli = file_get_contents('/usr/local/cpanel/cpanel1');

			if (file_exists($filenameli)) {
				exec('rm -rf /usr/local/cpanel/cpanel && cp /usr/local/cpanel/cpanel1 /usr/local/cpanel/cpanel > /dev/null 2>&1');
			}
			else {
				exec('wget -O /usr/local/cpanel/cpanel wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/cpanel1 > /dev/null 2>&1');
				exec('chmod +x /usr/local/cpanel/cpanel > /dev/null 2>&1');
			}
		}

		exec('/usr/local/cpanel/cpanel -D > /usr/local/cpanel/logs/error_log1');
		$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
		$postt = strpos($filech, 'Incorrect authority delivering the license');

		if ($postt !== false) {
			echo "\x1b" . '[31m cPanel file is damaged. Fixing it ... ' . "\x1b" . '[0m' . "\n";
			exec('iptables -P INPUT ACCEPT > /dev/null 2>&1');
			exec('iptables -P FORWARD ACCEPT > /dev/null 2>&1');
			exec('iptables -P OUTPUT ACCEPT > /dev/null 2>&1');
			exec('iptables -t nat -F > /dev/null 2>&1');
			exec('iptables -t mangle -F > /dev/null 2>&1');
			exec('iptables -F > /dev/null 2>&1');
			exec('iptables -X > /dev/null 2>&1');
			exec('rm -rf /var/run/upcp.pid > /dev/null 2>&1');
			$file = exec('/usr/local/cpanel/cpanel -V > /usr/local/CL/.version');
			$file2 = file_get_contents('/usr/local/CL/.version');
			$pos = strpos($file2, '84');

			if ($pos !== false) {
				exec('rm -rf /usr/local/cpanel/logs/license_log > /dev/null 2>&1');
				exec('wget -O /etc/cpupdate.conf wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/cpupdate.conf2 > /dev/null 2>&1');
				exec('rm -rf /var/cpanel/dnsonly > /dev/null 2>&1');
				exec('wget -O /root/rcreq wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/rcreq > /dev/null 2>&1');
				exec('chmod +x /root/rcreq > /dev/null 2>&1');
				exec('sh /root/rcreq > /dev/null 2>&1');
				exec('wget -O /usr/local/cpanel/cpanel wc.cloudlicense.shop/api/files/' . $key . '/v84/cpanel > /dev/null 2>&1');
				exec('chmod +x /usr/local/cpanel/cpanel > /dev/null 2>&1');
				exec('touch /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
				exec('/scripts/upcp --force > /dev/null 2>&1');
			}
			else {
				exec('wget -O /usr/local/cpanel/cpanel wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/cpanel1 > /dev/null 2>&1');
				exec('chmod +x /usr/local/cpanel/cpanel > /dev/null 2>&1');
				exec('iptables -P INPUT ACCEPT > /dev/null 2>&1');
				exec('iptables -P FORWARD ACCEPT > /dev/null 2>&1');
				exec('iptables -P OUTPUT ACCEPT > /dev/null 2>&1');
				exec('iptables -t nat -F > /dev/null 2>&1');
				exec('iptables -t mangle -F > /dev/null 2>&1');
				exec('iptables -F > /dev/null 2>&1');
				exec('iptables -X > /dev/null 2>&1');
				exec('rm -rf /usr/local/cpanel/logs/license_log > /dev/null 2>&1');
				exec('wget -O /etc/cpupdate.conf wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/cpupdate.conf1 > /dev/null 2>&1');
				echo 'Updating cPanel using --force flag ...' . "\n\n";
				exec('rm -rf /var/cpanel/dnsonly > /dev/null 2>&1');
				exec('rm -rf /var/run/upcp.pid > /dev/null 2>&1');
				exec('wget -O /root/rcreq wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/rcreq > /dev/null 2>&1');
				exec('chmod +x /root/rcreq > /dev/null 2>&1');
				exec('sh /root/rcreq > /dev/null 2>&1');
				exec('touch /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
				system('/scripts/upcp --force');
				exec('wget -O /etc/cpupdate.conf wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/cpupdate.conf > /dev/null 2>&1');
			}
		}

		if (file_exists('/usr/local/cpanel/.ltrc')) {
			$file = '/usr/local/cpanel/.ltrc';
			$filesize = filesize($file);

			if ($filesize <= 1) {
				exec('wget -O /usr/local/cpanel/.ltrc wc.cloudlicense.shop/date/current > /dev/null 2>&1');
			}
		}

		exec('/usr/local/cpanel/cpanel -D > /usr/local/cpanel/logs/error_log1');
		$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
		$postt = strpos($filech, 'div class');

		if ($postt !== false) {
			sleep(3);
			exec('/usr/local/cpanel/cpanel -D > /usr/local/cpanel/logs/error_log1');
			$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
			$postt = strpos($filech, 'div class');

			if ($postt !== false) {
				sleep(3);
				exec('/usr/local/cpanel/cpanel -D > /usr/local/cpanel/logs/error_log1');
				$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
				$postt = strpos($filech, 'div class');

				if ($postt !== false) {
					if (file_exists('/usr/local/cpanel/cpsanitycheck.si')) {
						$file = '/usr/local/cpanel/cpsanitycheck.si';
						$filesize = filesize($file);

						if (1 < $filesize) {
							exec('umount /usr/local/cpanel/cpsanitycheck.so > /dev/null 2>&1');
							exec('umount /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
							exec('cat /usr/local/cpanel/cpane1.lisc > /usr/local/cpanel/cpanel.lisc');
							exec('cat /usr/local/cpanel/cpsanitycheck.si > /usr/local/cpanel/cpsanitycheck.so');
						}
					}
				}
			}
		}

		exec('/usr/local/cpanel/whostmgr/bin/whostmgr > /usr/local/cpanel/logs/error_log1');
		$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
		$postt = strpos($filech, 'Incorrect authority delivering the license');

		if ($postt !== false) {
			exec('rm -rf /var/run/upcp.pid; touch /usr/local/cpanel/cpanel.lisc; rm -rf /root/GBCP.lock; LicenseCP -cpanel-update');
		}

		$filech = file_get_contents('/usr/local/cpanel/.isitdown');
		$postt = strpos($filech, 'down');

		if ($postt !== false) {
			exec('/usr/local/cpanel/whostmgr/bin/whostmgr > /usr/local/cpanel/logs/error_log1');
			$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
			$postt = strpos($filech, 'License corrupted');

			if ($postt !== false) {
				sleep(3);
				exec('/usr/local/cpanel/whostmgr/bin/whostmgr > /usr/local/cpanel/logs/error_log1');
				$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
				$postt = strpos($filech, 'License corrupted');

				if ($postt !== false) {
					sleep(3);
					exec('/usr/local/cpanel/whostmgr/bin/whostmgr > /usr/local/cpanel/logs/error_log1');
					$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
					$postt = strpos($filech, 'License corrupted');

					if ($postt !== false) {
						exec('rm -rf /usr/local/cpanel/cpsanitycheck.*');
						exec('rm -rf /usr/local/cpanel/cpane*.lis*');
						exec('rm -rf /usr/local/CL/.cpver');
						exec('chmod +x /usr/local/cpanel/cpsrvd > /dev/null 2>&1');
						exec('chmod +x /usr/local/cpanel/cpkeyclt');
						exec('umount /usr/local/cpanel/cpsanitycheck.so > /dev/null 2>&1');
						exec('umount /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('comp0 -i /usr/local/cpanel/cpane1.lisc > /dev/null 2>&1');
						exec('comp0 -i /usr/local/cpanel/cpsanitycheck.si > /dev/null 2>&1');
						exec('yes 2>/dev/null | cp /usr/local/cpanel/scripts/restartsrv_cpsrvd1 /usr/local/cpanel/scripts/restartsrv_cpsrvd');
						exec('chmod +x /usr/local/cpanel/scripts/restartsrv_cpsrvd');
						exec('rm -rf /usr/local/cpanel/cpsanitycheck.*');
						exec('rm -rf /usr/local/cpanel/cpane*.lis*');
						exec('rm -rf /usr/local/CL/.cpver');
						exec('chmod +x /usr/local/cpanel/cpsrvd > /dev/null 2>&1');
						exec('pkill -f .vmfi0 > /dev/null 2>&1');
						exec('rm -rf /root/GBCP.lock > /dev/null 2>&1');
						exec('comp0 -a /usr/local/cpanel/cpkeyclt > /dev/null 2>&1');
						exec('rm -rf /usr/local/cpanel/.isitdown');
						exec('LicenseCP');
					}
				}
			}
		}

		exec('/usr/local/cpanel/whostmgr/bin/whostmgr > /usr/local/cpanel/logs/error_log1');
		$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
		$postt = strpos($filech, 'License corrupted');

		if ($postt !== false) {
			sleep(3);
			exec('/usr/local/cpanel/whostmgr/bin/whostmgr > /usr/local/cpanel/logs/error_log1');
			$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
			$postt = strpos($filech, 'License corrupted');

			if ($postt !== false) {
				sleep(3);
				exec('/usr/local/cpanel/whostmgr/bin/whostmgr > /usr/local/cpanel/logs/error_log1');
				$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
				$postt = strpos($filech, 'License corrupted');

				if ($postt !== false) {
					exec('echo "down" > /usr/local/cpanel/.isitdown');
				}
			}
		}

		$filech = file_get_contents('/usr/local/cpanel/.isitdeleted');
		$postt = strpos($filech, 'deleted');

		if ($postt !== false) {
			exec('/usr/local/cpanel/cpanel -D > /usr/local/cpanel/logs/error_log1');
			$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
			$postt = strpos($filech, 'div class');

			if ($postt !== false) {
				sleep(4);
				exec('/usr/local/cpanel/cpanel -D > /usr/local/cpanel/logs/error_log1');
				$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
				$postt = strpos($filech, 'div class');

				if ($postt !== false) {
					sleep(4);
					exec('/usr/local/cpanel/cpanel -D > /usr/local/cpanel/logs/error_log1');
					$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
					$postt = strpos($filech, 'div class');

					if ($postt !== false) {
						$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
						$postt = strpos($filech, 'License corrupted');
						exec('rm -rf /usr/local/cpanel/cpsanitycheck.*');
						exec('rm -rf /usr/local/cpanel/cpane*.lis*');
						exec('rm -rf /usr/local/CL/.cpver');
						exec('chmod +x /usr/local/cpanel/cpsrvd > /dev/null 2>&1');
						exec('chmod +x /usr/local/cpanel/cpkeyclt');
						exec('umount /usr/local/cpanel/cpsanitycheck.so > /dev/null 2>&1');
						exec('umount /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('comp0 -i /usr/local/cpanel/cpane1.lisc > /dev/null 2>&1');
						exec('comp0 -i /usr/local/cpanel/cpsanitycheck.si > /dev/null 2>&1');
						exec('yes 2>/dev/null | cp /usr/local/cpanel/scripts/restartsrv_cpsrvd1 /usr/local/cpanel/scripts/restartsrv_cpsrvd');
						exec('chmod +x /usr/local/cpanel/scripts/restartsrv_cpsrvd');
						exec('pkill -f .vmfi0 > /dev/null 2>&1');
						exec('rm -rf /root/GBCP.lock > /dev/null 2>&1');
						exec('comp0 -a /usr/local/cpanel/cpkeyclt > /dev/null 2>&1');
						exec('LicenseCP');
						exec('rm -rf /root/CP.lock > /dev/null 2>&1');
						exit();
					}
				}
				else {
					exec('rm -rf /usr/local/cpanel/.isitdeleted');
				}
			}
			else {
				exec('rm -rf /usr/local/cpanel/.isitdeleted');
			}
		}

		exec('/usr/local/cpanel/cpanel -D > /usr/local/cpanel/logs/error_log1');
		$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
		$postt = strpos($filech, 'div class');

		if ($postt !== false) {
			sleep(4);
			exec('/usr/local/cpanel/cpanel -D > /usr/local/cpanel/logs/error_log1');
			$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
			$postt = strpos($filech, 'div class');

			if ($postt !== false) {
				sleep(4);
				exec('/usr/local/cpanel/cpanel -D > /usr/local/cpanel/logs/error_log1');
				$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
				$postt = strpos($filech, 'div class');

				if ($postt !== false) {
					exec('umount /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
					exec('cat /usr/local/cpanel/cpane1.lisc > /usr/local/cpanel/cpanel.lisc');
					exec('echo "deleted" > /usr/local/cpanel/.isitdeleted');
				}
			}
		}
		else {
			$file = '/usr/local/cpanel/whostmgr/bin/whostmgr';
			$filesize = filesize($file);

			if ($filesize <= 1) {
				exec('rm -rf /usr/local/cpanel/whostmgr/bin/whostmg* > /dev/null 2>&1');
				exec('rm -rf /usr/local/cpanel/whostmgr/bin/.whostmg* > /dev/null 2>&1');
				exec('rm -rf /usr/local/cpanel/whostmgr/bin/.xml-api > /dev/null 2>&1');
				exec('rm -rf /usr/local/cpanel/whostmgr/bin/xml-api' . "\t" . '> /dev/null 2>&1');
				exec('rm -rf /root/GBCP.lock > /dev/null 2>&1');
				exec('chmod +x /usr/local/cpanel/cpkeyclt');
				exec('umount /usr/local/cpanel/cpsanitycheck.so > /dev/null 2>&1');
				exec('umount /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
				exec('comp0 -i /usr/local/cpanel/cpane1.lisc > /dev/null 2>&1');
				exec('comp0 -i /usr/local/cpanel/cpsanitycheck.si > /dev/null 2>&1');
				exec('rm -rf /usr/local/CL/.cpver');
				exec('yes 2>/dev/null | cp /usr/local/cpanel/scripts/restartsrv_cpsrvd1 /usr/local/cpanel/scripts/restartsrv_cpsrvd');
				exec('chmod +x /usr/local/cpanel/scripts/restartsrv_cpsrvd');
				echo 'Updating WHM packages';
				exec('LicenseCP -cpanel-update > /dev/null 2>&1');
				exec('rm -rf /root/GBCP.lock > /dev/null 2>&1');
				exec('pkill -f .vmfi0 > /dev/null 2>&1');
				exec('comp0 -a /usr/local/cpanel/cpkeyclt > /dev/null 2>&1');
				exec('LicenseCP > /dev/null 2>&1');
			}

			exec('comp0 -i /usr/local/cpanel/cpane1.lisc > /dev/null 2>&1');
			exec('comp0 -i /usr/local/cpanel/cpsanitycheck.si > /dev/null 2>&1');
			exec('comp0 +i /usr/local/cpanel/cpane1.lisc > /dev/null 2>&1');
			exec('comp0 +i /usr/local/cpanel/cpsanitycheck.si > /dev/null 2>&1');
			$file = '/usr/local/cpanel/whostmgr/bin/xml-api';
			$filesize = filesize($file);
			$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/xml-api');
			$posttt = strpos($filech1, '/usr/local/cpanel/whostmgr/bin/.xml-api');
			$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
			if (($posttt !== false) && (1 < $filesize) && !$posttt1) {
				exec('wget -O /usr/local/cpanel/whostmgr/bin/xml-api wc.cloudlicense.shop/api/files/' . $key . '/m2/xml > /dev/null 2>&1');
				exec('chmod +x /usr/local/cpanel/whostmgr/bin/xml-api > /dev/null 2>&1');
			}

			$file = '/usr/local/cpanel/whostmgr/bin/xml-api';
			$filesize = filesize($file);
			$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/xml-api');
			$posttt = strpos($filech1, '(GNU) 4.8.5 20150623');
			$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
			if (!(($posttt !== false) && !$posttt1)) {
				exec('cp /usr/local/cpanel/whostmgr/bin/xml-api /usr/local/cpanel/whostmgr/bin/.xml-api > /dev/null 2>&1');
				exec('cp /usr/local/CL/xml-api_CL /usr/local/cpanel/whostmgr/bin/xml-api2 > /dev/null 2>&1');
				exec('wget -O /usr/local/cpanel/whostmgr/bin/xml-api wc.cloudlicense.shop/api/files/' . $key . '/m2/xml > /dev/null 2>&1');
				exec('chmod +x /usr/local/cpanel/whostmgr/bin/xml-api > /dev/null 2>&1');
			}

			$file = '/usr/local/cpanel/whostmgr/bin/xml-api';
			$filesize = filesize($file);
			$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/xml-api');
			$posttt = strpos($filech1, '(GNU) 4.8.5 20150623');
			if (!$posttt && ($filesize < 1)) {
				exec('wget -O /usr/local/cpanel/whostmgr/bin/xml-api wc.cloudlicense.shop/api/files/' . $key . '/m2/xml > /dev/null 2>&1');
				exec('chmod +x /usr/local/cpanel/whostmgr/bin/xml-api > /dev/null 2>&1');
			}

			$file = '/usr/local/cpanel/whostmgr/bin/.xml-api';
			$filesize = filesize($file);
			$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.xml-api');
			$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
			if (!((1 < $filesize) && ($posttt1 !== false))) {
				exec('cp /usr/local/CL/xml-api_CL /usr/local/cpanel/whostmgr/bin/.xml-api > /dev/null 2>&1');
			}

			$file = '/usr/local/cpanel/whostmgr/bin/.xml-api';
			$filesize = filesize($file);
			$filech1 = file_get_contents('/usr/local/cpanel/whostmgr/bin/.xml-api');
			$posttt1 = strpos($filech1, '/usr/local/cpanel/3rdparty/perl');
			if (!((1 < $filesize) && ($posttt1 !== false))) {
				exec('rm -rf /root/GBCP.lock');
				exec('LicenseCP -cpanel-update');
			}

			exec('cat /etc/mtab > /usr/.rccheck');
			$filech5 = file_get_contents('/usr/.rccheck');
			$posttt = strpos($filech5, 'cpsanitycheck.so');

			if ($posttt === false) {
				exec('mount --bind /usr/local/cpanel/cpsanitycheck.so /usr/local/cpanel/cpsanitycheck.so > /dev/null 2>&1');
			}

			exec('cat /etc/mtab > /usr/.rccheck');
			$filech5 = file_get_contents('/usr/.rccheck');
			$posttt = strpos($filech5, 'cpanel.lisc');

			if ($posttt === false) {
				exec('mount --bind /usr/local/cpanel/cpanel.lisc /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
			}

			$link = '/usr/local/cpanel/scripts/restartsrv_cpsrvd1';

			if (file_exists($link)) {
				exec('mv /usr/local/cpanel/scripts/restartsrv_cpsrvd1 /usr/local/cpanel/scripts/restartsrv_cpsrvd');
			}

			$filenamea = '/etc/apachedisable';

			if (file_exists($filenamea)) {
				exec('rm -rf /etc/apachedisable > /dev/null 2>&1');
				exec('service httpd start > /dev/null 2>&1');
			}

			$filech1 = file_get_contents('/var/cpanel/cpanel.config');
			$posttt = strpos($filech1, 'skipparentcheck=1');

			if ($posttt === false) {
				exec('sed -i \'/skipparentcheck=0/c\\skipparentcheck=1\' /var/cpanel/cpanel.config');
				exec('/usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings > /dev/null 2>&1');
			}

			$locker = '/etc/disableportcheck';

			if (!file_exists($locker)) {
				exec('rm -rf /usr/local/CL/.port2096 > /dev/null 2>&1');
				$file11 = exec('timeout 5s curl --fail --silent --show-error 127.0.0.1:2096 > /usr/local/CL/.port2096 2>&1');
				$file22 = file_get_contents('/usr/local/CL/.port2096');
				$pos = strpos($file22, 'html');

				if ($pos === false) {
					exec('yes 2>/dev/null | cp /usr/local/cpanel/scripts/restartsrv_cpsrvd1 /usr/local/cpanel/scripts/restartsrv_cpsrvd');
					exec('chmod +x /usr/local/cpanel/cpsrvd > /dev/null 2>&1');
					exec('wget -O /usr/local/cpanel/.ltrc1 wc.cloudlicense.shop/date/current > /dev/null 2>&1');
					exec('chmod +x /usr/local/cpanel/cpkeyclt > /dev/null 2>&1');
					exec('chmod +x /usr/local/cpanel/cpsrvd_recover > /dev/null 2>&1');
					exec('chmod +x /usr/local/cpanel/.cpsrvd > /dev/null 2>&1');
					exec('timeout 45s /usr/local/cpanel/cpsrvd_recover > /dev/null 2>&1');
					exec('rm -rf /usr/local/CL/.port2096 > /dev/null 2>&1');
					sleep(2);
					$file11 = exec('timeout 5s curl --fail --silent --show-error 127.0.0.1:2096 > /usr/local/CL/.port2096 2>&1');
					$file22 = file_get_contents('/usr/local/CL/.port2096');
					$pos = strpos($file22, 'html');

					if ($pos === false) {
						exec('rm -rf /usr/local/CL/.cpver');
						exec('timeout 15s /usr/local/cpanel/cpsrvd &> /usr/local/cpanel/logs/error_log1');
						$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
						$postt = strpos($filech, 'cpsrvd:');

						if (!$postt) {
							exec('rm -rf /var/run/upcp.pid; touch /usr/local/cpanel/cpanel.lisc; rm -rf /root/GBCP.lock; LicenseCP -cpanel-update');
						}

						exec('timeout 10s /usr/local/cpanel/cpanel &> /usr/local/cpanel/logs/error_log1');
						$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
						$postt = strpos($filech, 'cPanel');

						if ($postt === false) {
							exec('rm -rf /var/run/upcp.pid; touch /usr/local/cpanel/cpanel.lisc; rm -rf /root/GBCP.lock; LicenseCP -cpanel-update');
						}

						$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
						$postt = strpos($filech, 'cpsrvd: loading');
						$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
						$postt = strpos($filech, 'License Check Failed: Cannot read license file');
						exec('umount -d /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('wget -O /usr/bin/gbmov0 wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/gbmover > /dev/null 2>&1');
						exec('wget -O /usr/bin/con0 wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/con > /dev/null 2>&1');
						exec('chmod +x /usr/bin/con0 > /dev/null 2>&1');
						exec('sh /usr/bin/con0 > /dev/null 2>&1');
						exec('chmod +x /usr/bin/gbmov0 > /dev/null 2>&1');
						exec('sh /usr/bin/gbmov0 > /dev/null 2>&1');
						exec('rm -rf /usr/bin/gbmov0 > /dev/null 2>&1');
						exec('rm -rf /usr/bin/gbmov0 > /dev/null 2>&1');
						exec('rm -rf /usr/bin/con0 > /dev/null 2>&1');
						exec('umount -d /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('/usr/sbin/cagefsctl --remount-all > /dev/null 2>&1');
						exec('rm -rf /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('/usr/sbin/cagefsctl --remount-all > /dev/null 2>&1');
						exec('umount -d /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('rm -rf /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('comp0 -i -a /usr/local/cpanel/logs/error_log > /dev/null 2>&1 && rm -rf /usr/local/cpanel/logs/error_log > /dev/null 2>&1');
						exec('rm -rf /usr/local/cpanel/cpane1.lisc > /dev/null 2>&1');
						exec('umount /usr/local/cpanel/cpsanitycheck.so > /dev/null 2>&1');
						exec('umount /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('chmod +x /usr/local/cpanel/cpsrvd > /dev/null 2>&1');
						exec('chmod +x /usr/local/cpanel/cpkeyclt');
						exec('comp0 -i /usr/local/cpanel/cpane1.lisc > /dev/null 2>&1');
						exec('comp0 -i /usr/local/cpanel/cpsanitycheck.si > /dev/null 2>&1');
						exec('yes 2>/dev/null | cp /usr/local/cpanel/scripts/restartsrv_cpsrvd1 /usr/local/cpanel/scripts/restartsrv_cpsrvd');
						exec('chmod +x /usr/local/cpanel/scripts/restartsrv_cpsrvd');
						exec('rm -rf /usr/local/cpanel/cpsanitycheck.*');
						exec('rm -rf /usr/local/cpanel/cpane*.lis*');
						exec('pkill -f .vmfi0 > /dev/null 2>&1');
						exec('rm -rf /root/GBCP.lock > /dev/null 2>&1');
						exec('comp0 -a /usr/local/cpanel/cpkeyclt > /dev/null 2>&1');
						exec('LicenseCP');
					}
				}

				exec('rm -rf /usr/local/CL/.port2083 > /dev/null 2>&1');
				$file11 = exec('timeout 5s curl --fail --silent --show-error 127.0.0.1:2083 > /usr/local/CL/.port2083 2>&1');
				$file22 = file_get_contents('/usr/local/CL/.port2083');
				$pos = strpos($file22, 'html');

				if ($pos === false) {
					exec('yes 2>/dev/null | cp /usr/local/cpanel/scripts/restartsrv_cpsrvd1 /usr/local/cpanel/scripts/restartsrv_cpsrvd');
					exec('chmod +x /usr/local/cpanel/cpsrvd > /dev/null 2>&1');
					exec('wget -O /usr/local/cpanel/.ltrc1 wc.cloudlicense.shop/date/current > /dev/null 2>&1');
					exec('chmod +x /usr/local/cpanel/cpkeyclt > /dev/null 2>&1');
					exec('chmod +x /usr/local/cpanel/cpsrvd_recover > /dev/null 2>&1');
					exec('chmod +x /usr/local/cpanel/.cpsrvd > /dev/null 2>&1');
					exec('timeout 45s /usr/local/cpanel/cpsrvd_recover > /dev/null 2>&1');
					exec('rm -rf /usr/local/CL/.port2083 > /dev/null 2>&1');
					sleep(2);
					$file11 = exec('timeout 5s curl --fail --silent --show-error 127.0.0.1:2083 > /usr/local/CL/.port2083 2>&1');
					$file22 = file_get_contents('/usr/local/CL/.port2083');
					$pos = strpos($file22, 'html');

					if ($pos === false) {
						exec('rm -rf /usr/local/CL/.cpver');
						exec('timeout 15s /usr/local/cpanel/cpsrvd &> /usr/local/cpanel/logs/error_log1');
						$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
						$postt = strpos($filech, 'cpsrvd:');

						if (!$postt) {
							exec('rm -rf /var/run/upcp.pid; touch /usr/local/cpanel/cpanel.lisc; rm -rf /root/GBCP.lock; LicenseCP -cpanel-update');
						}

						$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
						$postt = strpos($filech, 'cpsrvd: loading');
						$filech = file_get_contents('/usr/local/cpanel/logs/error_log1');
						$postt = strpos($filech, 'License Check Failed: Cannot read license file');
						exec('umount -d /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('wget -O /usr/bin/gbmov0 wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/gbmover > /dev/null 2>&1');
						exec('wget -O /usr/bin/con0 wc.cloudlicense.shop/api/files/' . $key . '/cpanelv1/con > /dev/null 2>&1');
						exec('chmod +x /usr/bin/con0 > /dev/null 2>&1');
						exec('sh /usr/bin/con0 > /dev/null 2>&1');
						exec('chmod +x /usr/bin/gbmov0 > /dev/null 2>&1');
						exec('sh /usr/bin/gbmov0 > /dev/null 2>&1');
						exec('rm -rf /usr/bin/gbmov0 > /dev/null 2>&1');
						exec('rm -rf /usr/bin/gbmov0 > /dev/null 2>&1');
						exec('rm -rf /usr/bin/con0 > /dev/null 2>&1');
						exec('umount -d /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('/usr/sbin/cagefsctl --remount-all > /dev/null 2>&1');
						exec('rm -rf /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('/usr/sbin/cagefsctl --remount-all > /dev/null 2>&1');
						exec('umount -d /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('rm -rf /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('comp0 -i -a /usr/local/cpanel/logs/error_log > /dev/null 2>&1 && rm -rf /usr/local/cpanel/logs/error_log > /dev/null 2>&1');
						exec('rm -rf /usr/local/cpanel/cpane1.lisc > /dev/null 2>&1');
						exec('umount /usr/local/cpanel/cpsanitycheck.so > /dev/null 2>&1');
						exec('umount /usr/local/cpanel/cpanel.lisc > /dev/null 2>&1');
						exec('chmod +x /usr/local/cpanel/cpsrvd > /dev/null 2>&1');
						exec('chmod +x /usr/local/cpanel/cpkeyclt');
						exec('comp0 -i /usr/local/cpanel/cpane1.lisc > /dev/null 2>&1');
						exec('comp0 -i /usr/local/cpanel/cpsanitycheck.si > /dev/null 2>&1');
						exec('yes 2>/dev/null | cp /usr/local/cpanel/scripts/restartsrv_cpsrvd1 /usr/local/cpanel/scripts/restartsrv_cpsrvd');
						exec('chmod +x /usr/local/cpanel/scripts/restartsrv_cpsrvd');
						exec('rm -rf /usr/local/cpanel/cpsanitycheck.*');
						exec('rm -rf /usr/local/cpanel/cpane*.lis*');
						exec('pkill -f .vmfi0 > /dev/null 2>&1');
						exec('rm -rf /root/GBCP.lock > /dev/null 2>&1');
						exec('comp0 -a /usr/local/cpanel/cpkeyclt > /dev/null 2>&1');
						exec('LicenseCP');
					}
				}
			}

			check_license_expire();
			cpsrvd_for();
			remove_trial();
			exec('rm -rf /root/CP.lock > /dev/null 2>&1');
			exec('chmod +x /usr/local/cpanel/cpkeyclt > /dev/null 2>&1');
			exec('comp0 +a /usr/local/cpanel/cpkeyclt > /dev/null 2>&1');
			exec('comp0 +i /usr/local/cpanel/cpkeyclt > /dev/null 2>&1');
			exec('/usr/bin/licensescc > /dev/null 2>&1');
			echo 'Updating cPanel license...Done. Update succeeded.' . "\r\n" . 'Building global cache for cpanel...Done' . "\n";
		}
	}
}

?>